﻿<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
    <title></title>
    <link href="/Contents/css/datagridtop.css" rel="stylesheet" type="text/css" />
    <script src="/Contents/scripts/jquery-1.8.0.min.js"type="text/javascript"></script>
    <script src="/Contents/scripts/jquery-easyui-1.3.2/jquery.easyui.min.js"type="text/javascript"></script>
    <link href="/Contents/scripts/jquery-easyui-1.3.2/themes/default/easyui.css"rel="stylesheet" type="text/css" />
    <link href="/Contents/scripts/jquery-easyui-1.3.2/themes/icon.css" rel="stylesheet"type="text/css" />
    <script src="/Contents/scripts/jquery-easyui-1.3.2/locale/easyui-lang-zh_CN.js" type="text/javascript"></script>
    <script src="/Contents/scripts/shadeform/script/form.js" type="text/javascript"></script>
    <link href="/Contents/scripts/shadeform/style/formsytle.css" rel="stylesheet"type="text/css" />
    <script src="/Contents/scripts/functions.js" type="text/javascript"></script>
    <script src="/Contents/scripts/manager-js/fritems-manager.js" type="text/javascript"></script>
</head>
<body style="background: none; padding-left: 15px; padding-right: 15px; padding-top: 2px;text-align: center;">
    <div class="GridTablesTop" id="biaotouwidth" style="width: 100%;">
    <span class="spl">
            <strong><span>&nbsp;财经法规题库</span></strong>
        </span>
    </div>
    <div class="Tab">
        <ul style="padding-left:0px;">
            <li><a href="#" id="tab_1" class="now"  onclick="setTab(1)">单选题</a></li>
            <li><a href="#" id="tab_2" onclick="setTab_reload(2)">多选题</a></li>
            <li><a href="#" id="tab_3" onclick="setTab_reload(3)">判断题</a></li>
            <li><a href="#" id="tab_4" onclick="setTab_reload(4)">案例分析题</a></li>
        </ul>
    </div>
    <div  id="tab_div_1" style="display: block"><div style="height:8px;"></div><table id="dg_single"  style="margin-top:5px;"></table></div>
    <div  id="tab_div_2" style="display: none"><div style="height:8px;"></div><table id="dg_multiple"  style="margin-top:5px;"></table></div>
    <div  id="tab_div_3" style="display: none"><div style="height:8px;"></div><table id="dg_judge"  style="margin-top:5px;"></table></div>
    <div  id="tab_div_4" style="display: none"><div style="height:8px;"></div><table id="dg_analysis"  style="margin-top:5px;"></table></div>

    <script type="text/javascript">
        $(function () {
            // 单选题
            var toolbar_single = [{
                text: '添加单选题',
                iconCls: 'icon-add',
                handler: function () { showAddSingleForm(); }
            }, '-', {
                text: '搜索单选题',
                iconCls: 'icon-search',
                handler: function () { showQuerySingleForm(); }
            }];
            // 多选题
            var toolbar_multiple = [{
                text: '添加多选题',
                iconCls: 'icon-add',
                handler: function () { showAddMultipleForm(); }
            }, '-', {
                text: '搜索多选题',
                iconCls: 'icon-search',
                handler: function () { showQueryMultipleForm(); }
            }];
            // 判断题
            var toolbar_judge = [{
                text: '添加判断题',
                iconCls: 'icon-add',
                handler: function () { showAddJudgeForm(); }
            }, '-', {
                text: '搜索判断题',
                iconCls: 'icon-search',
                handler: function () { showQueryJudgeForm(); }
            }];
            // 案例分析题
            var toolbar_analysis = [{
                text: '添加案例',
                iconCls: 'icon-add',
                handler: function () { showAddDescripeForm(); }
            }, '-', {
                text: '搜索案例',
                iconCls: 'icon-search',
                handler: function () { showQueryDescripeForm(); }
            }];

            // 单选题表格
            $('#dg_single').datagrid({
                width: parseFloat(document.getElementById("biaotouwidth").clientWidth),
                striped: true,
                loading: true,
                loadMsg: "正在加载数据,请稍等...",
                idField: 'id',
                height: 440,
                singleSelect: true,
                toolbar: toolbar_single,
                autoRowHeight: false,
                url: '/FrSingleManagement/GetFrSingleJson?t=' + Math.random(),
                columns: [[
                    { field: 'title', title: '题目', width: ($(document.body).width() - 235) * 0.60, align: 'left',
                        styler: function (value, row, index) {
                            return 'overflow:hidden;white-space:nowrap;text-overflow: ellipsis;';
                        }
                    },
                    { field: 'answer_key', title: '答案', width: ($(document.body).width() - 235) * 0.10, align: 'center' },
                    { field: 'add_person', title: '添加人', width: ($(document.body).width() - 230) * 0.12, align: 'center' },
                    { field: 'add_time', title: '添加时间', width: ($(document.body).width() - 230) * 0.18, align: 'center' },
                    {
                        field: 'operation', title: '操作', width: 200, align: 'center',
                        formatter: function (value, rowData) {
                            var s = '<img src="/contents/images/admin/delete.png" align="middle""/>&nbsp;<a href="#" onclick="deleteSingle(\'' + rowData.id + '\')" title="删除" style="color:blue;margin-left:5px; margin-right:5px;text-decoration: none;">删除</a>';
                            s += '&nbsp;|&nbsp;&nbsp;&nbsp;<img src="/contents/images/admin/pencil.png" align="middle"/>&nbsp;<a href="#" onclick="showUpdateSingleForm(\'' + rowData.id + '\')" title="修改" style="color:blue;margin-left:5px; margin-right:5px;text-decoration: none;">修改</a>';
                            return s;
                        }
                    }
	            ]],
                rowStyler: function (index, row) {
                    return 'height:35px;';
                },
                rownumbers: true,
                singleSelect: true,
                pagination: true,
                onLoadSuccess: function (data) {
                    if (data.rows.length == 0) {
                        var body = $(this).data().datagrid.dc.body2;
                        body.find('table tbody').html('<tr><td colspan="5" width="' + body.width() + '" style="height: 25px; text-align: center;">没有数据</td></tr>');
                    }
                }
            });

            // 多选题表格
            $('#dg_multiple').datagrid({
                width: parseFloat(document.getElementById("biaotouwidth").clientWidth),
                striped: true,
                loading: true,
                loadMsg: "正在加载数据,请稍等...",
                idField: 'id',
                height: 440,
                singleSelect: true,
                toolbar: toolbar_multiple,
                autoRowHeight: false,
                columns: [[
                    { field: 'title', title: '题目', width: ($(document.body).width() - 235) * 0.60, align: 'left',
                        styler: function (value, row, index) {
                            return 'overflow:hidden;white-space:nowrap;text-overflow: ellipsis;';
                        }
                    },
                    { field: 'answer_key', title: '答案', width: ($(document.body).width() - 235) * 0.10, align: 'center' },
                    { field: 'add_person', title: '添加人', width: ($(document.body).width() - 230) * 0.12, align: 'center' },
                    { field: 'add_time', title: '添加时间', width: ($(document.body).width() - 230) * 0.18, align: 'center' },
                    {
                        field: 'operation', title: '操作', width: 200, align: 'center',
                        formatter: function (value, rowData) {
                            var s = '<img src="/contents/images/admin/delete.png" align="middle""/>&nbsp;<a href="#" onclick="deleteMultiple(\'' + rowData.id + '\')" title="删除" style="color:blue;margin-left:5px; margin-right:5px;text-decoration: none;">删除</a>';
                            s += '&nbsp;|&nbsp;&nbsp;&nbsp;<img src="/contents/images/admin/pencil.png" align="middle"/>&nbsp;<a href="#" onclick="showUpdateMultipleForm(\'' + rowData.id + '\')" title="修改" style="color:blue;margin-left:5px; margin-right:5px;text-decoration: none;">修改</a>';
                            return s;
                        }
                    }
	            ]],
                rowStyler: function (index, row) {
                    return 'height:35px;';
                },
                rownumbers: true,
                singleSelect: true,
                pagination: true,
                onLoadSuccess: function (data) {
                    if (data.rows.length == 0) {
                        var body = $(this).data().datagrid.dc.body2;
                        body.find('table tbody').html('<tr><td colspan="5" width="' + body.width() + '" style="height: 25px; text-align: center;">没有数据</td></tr>');
                    }
                }
            });

            // 判断题表格
            $('#dg_judge').datagrid({
                width: parseFloat(document.getElementById("biaotouwidth").clientWidth),
                striped: true,
                loading: true,
                loadMsg: "正在加载数据,请稍等...",
                idField: 'id',
                height: 440,
                singleSelect: true,
                toolbar: toolbar_judge,
                autoRowHeight: false,
                columns: [[
                    { field: 'title', title: '题目', width: ($(document.body).width() - 235) * 0.60, align: 'left',
                        styler: function (value, row, index) {
                            return 'overflow:hidden;white-space:nowrap;text-overflow: ellipsis;';
                        }
                    },
                    { field: 'answer_key', title: '答案', width: ($(document.body).width() - 235) * 0.10, align: 'center',
                        formatter: function (value, rowData) {
                            var result;
                            if (value == "0") { result = "错误"; }
                            else { result = "正确"; }
                            return result;
                        }
                    },
                    { field: 'add_person', title: '添加人', width: ($(document.body).width() - 230) * 0.12, align: 'center' },
                    { field: 'add_time', title: '添加时间', width: ($(document.body).width() - 230) * 0.18, align: 'center' },
                    {
                        field: 'operation', title: '操作', width: 200, align: 'center',
                        formatter: function (value, rowData) {
                            var s = '<img src="/contents/images/admin/delete.png" align="middle""/>&nbsp;<a href="#" onclick="deleteJudge(\'' + rowData.id + '\')" title="删除" style="color:blue;margin-left:5px; margin-right:5px;text-decoration: none;">删除</a>';
                            s += '&nbsp;|&nbsp;&nbsp;&nbsp;<img src="/contents/images/admin/pencil.png" align="middle"/>&nbsp;<a href="#" onclick="showUpdateJudgeForm(\'' + rowData.id + '\')" title="修改" style="color:blue;margin-left:5px; margin-right:5px;text-decoration: none;">修改</a>';
                            return s;
                        }
                    }
            	]],
                rowStyler: function (index, row) {
                    return 'height:35px;';
                },
                rownumbers: true,
                singleSelect: true,
                pagination: true,
                onLoadSuccess: function (data) {
                    if (data.rows.length == 0) {
                        var body = $(this).data().datagrid.dc.body2;
                        body.find('table tbody').html('<tr><td colspan="6" width="' + body.width() + '" style="height: 25px; text-align: center;">没有数据</td></tr>');
                    }
                }
            });

            // 案例分析题描述资料表格
            $('#dg_analysis').datagrid({
                width: parseFloat(document.getElementById("biaotouwidth").clientWidth),
                striped: true,
                loading: true,
                loadMsg: "正在加载数据,请稍等...",
                idField: 'id',
                height: 440,
                singleSelect: true,
                toolbar: toolbar_analysis,
                autoRowHeight: false,
                columns: [[
                    { field: 'descripe', title: '题目', width: ($(document.body).width() - 200) * 0.63, align: 'left',
                        styler: function (value, row, index) {
                            return 'overflow:hidden;white-space:nowrap;text-overflow: ellipsis;';
                        }
                    },
                    { field: 'add_person', title: '添加人', width: ($(document.body).width() - 260) * 0.12, align: 'center' },
                    { field: 'add_time', title: '添加时间', width: ($(document.body).width() - 260) * 0.18, align: 'center' },
                    {
                        field: 'operation', title: '操作', width: 250, align: 'center',
                        formatter: function (value, rowData) {
                            var s = '<img src="/contents/images/admin/delete.png" align="middle""/>&nbsp;<a href="#" onclick="deleteDescripe(\'' + rowData.id + '\')" title="删除" style="color:blue;margin-left:5px; margin-right:5px;text-decoration: none;">删除</a>';
                            s += '&nbsp;|&nbsp;&nbsp;&nbsp;<img src="/contents/images/admin/pencil.png" align="middle"/>&nbsp;<a href="#" onclick="showUpdateDescripeForm(\'' + rowData.id + '\')" title="修改" style="color:blue;margin-left:5px; margin-right:5px;text-decoration: none;">修改</a>';
                            s += '&nbsp;|&nbsp;&nbsp;&nbsp;<img src="/contents/images/admin/edit_add.png" align="middle"/>&nbsp;<a href="#" onclick="showEditChoiceForm(\'' + rowData.id + '\')" title="编辑子题目" style="color:blue;margin-left:5px; margin-right:5px;text-decoration: none;">选择题</a>';
                            return s;
                        }
                    }
            	]],
                rowStyler: function (index, row) {
                    return 'height:35px;';
                },
                rownumbers: true,
                singleSelect: true,
                pagination: true,
                onLoadSuccess: function (data) {
                    if (data.rows.length == 0) {
                        var body = $(this).data().datagrid.dc.body2;
                        body.find('table tbody').html('<tr><td colspan="6" width="' + body.width() + '" style="height: 25px; text-align: center;">没有数据</td></tr>');
                    }
                }
            });

            // 当窗口大小发生变化时，调整DataGrid的大小  
            $(window).resize(function () {
                $('#dg_single').datagrid('resize', {
                    width: $(document.body).width()
                });
                $('#dg_multiple').datagrid('resize', {
                    width: $(document.body).width()
                });
                $('#dg_judge').datagrid('resize', {
                    width: $(document.body).width()
                });
                $('#dg_analysis').datagrid('resize', {
                    width: $(document.body).width()
                });
            });
        });

        var is_multiple_clicked = false;
        var is_judge_clicked = false;
        var is_analysis_clicked = false;
        function setTab_reload(index) {
            if (index == 2) {
                if (!is_multiple_clicked) {
                    $('#dg_multiple').datagrid({
                        url: '/FrMultipleManagement/GetFrMultipleJson?t=' + Math.random()
                    });
                    is_multiple_clicked = true;
                }
                setTab(2);
            }
            if (index == 3) {
                if (!is_judge_clicked) {
                    $('#dg_judge').datagrid({
                        url: '/FrJudgeManagement/GetFrJudgeJson?t=' + Math.random()
                    });
                    is_judge_clicked = true;
                }
                setTab(3);
            }
            if (index == 4) {
                if (!is_analysis_clicked) {
                    $('#dg_analysis').datagrid({
                        url: '/FrAnalysisDescripeManagement/GetFrDescripeJson?t=' + Math.random()
                    });
                    is_analysis_clicked = true;
                }
                setTab(4);
            }
        }

        // 1.单选题 2. 多选题 3.判断题 4 案例分析题 
        function setTab(index) {
            for (i = 1; i <= 4; i++) {
                var tab = document.getElementById("tab_" + i);
                var div = document.getElementById("tab_div_" + i);
                tab.className = i == index ? "now" : "";
                div.style.display = i == index ? "block" : "none";
            }
        }

        function closeShade() {
            Shade.hidden();
        }

        // 单选题刷新
        function reload_Single_DG() {
            Shade.hidden();

            $('#dg_single').datagrid({
                url: '/FrSingleManagement/GetFrSingleJson?t=' + Math.random()
            });
        }

        function reload_Single_DG_WithQuery(title, a, b, c, d, key, analysis) {
            Shade.hidden();

            $('#dg_single').datagrid({
                url: '/FrSingleManagement/QuerySingle?title=' + encodeURI(title) + '&a=' + encodeURI(a) + '&b=' + encodeURI(b) + '&c=' + c + '&d=' + encodeURI(d) + '&key=' + encodeURI(key) + '&analysis=' + encodeURI(analysis) + '&t=' + Math.random()
            });
        }
        // 多选题刷新
        function reload_Multiple_DG() {
            Shade.hidden();

            $('#dg_multiple').datagrid({
                url: '/FrMultipleManagement/GetFrMultipleJson?t=' + Math.random()
            });
        }

        function reload_Multiple_DG_WithQuery(title, a, b, c, d, key, analysis) {
            Shade.hidden();

            $('#dg_multiple').datagrid({
                url: '/FrMultipleManagement/QueryMultiple?title=' + encodeURI(title) + '&a=' + encodeURI(a) + '&b=' + encodeURI(b) + '&c=' + c + '&d=' + encodeURI(d) + '&key=' + encodeURI(key) + '&analysis=' + encodeURI(analysis) + '&t=' + Math.random()
            });
        }
        // 判断题刷新
        function reload_Judge_DG() {
            Shade.hidden();

            $('#dg_judge').datagrid({
                url: '/FrJudgeManagement/GetFrJudgeJson?t=' + Math.random()
            });
        }

        function reload_Judge_DG_WithQuery(title,key, analysis) {
            Shade.hidden();

            $('#dg_judge').datagrid({
                url: '/FrJudgeManagement/QueryJudge?title=' + encodeURI(title) + '&key=' + encodeURI(key) + '&analysis=' + encodeURI(analysis) + '&t=' + Math.random()
            });
        }
        // 案例分析题刷新
        function reload_Analysis_DG() {
            Shade.hidden();

            $('#dg_analysis').datagrid({
                url: '/FrAnalysisDescripeManagement/GetFrDescripeJson?t=' + Math.random()
            });
        }
        function reload_Analysis_DG_WithQuery(title) {
            Shade.hidden();

            $('#dg_analysis').datagrid({
                url: '/FrAnalysisDescripeManagement/QueryDescripe?title=' + encodeURI(title) + '&t=' + Math.random()
            });
        }
    </script>
</body>
</html>
